<?php
    
class FileOpenException extends Exception {
    pubilc function __toString() {
        return "FileOpenException ".$this->getCode()." : ".$getMessage()."<br />";
    }
}

class FileWriteException extends Exception {
    pubilc function __toString() {
        return "FileWriteException ".$this->getCode()." : ".$getMessage()."<br />";
    }
}

class FileLockException extends Exception {
    pubilc function __toString() {
        return "FileLockException ".$this->getCode()." : ".$getMessage()."<br />";
    }
}

try {
    throw new Exception("A terrible error has occurred", 42);
} catch (Exception $e) {
    echo "Exception ".$e->getCode().": ".$e->getMessage()."<br />";
    echo "In File: ".$e->getFile()." On line: ".$e->getLine()."<br />";
    echo $e;
}
